import java.awt.Graphics;
import java.util.ArrayList;


public class MenuHolder {
	private Menu baseMenu;
	private Menu dieMenu;
	private Menu tradeMenu;
	private Menu buildMenu;
	private Menu handDisplay;
	private Menu discardMenu;
	private ArrayList<Menu> menus;
	SOCApplet applet;
	
	
	//creates and holds all the menus
	public MenuHolder(int size, ArrayList<Player> players, SOCApplet applet){
		menus = new ArrayList<Menu>();
		dieMenu = new DieMenu(players, applet);
		tradeMenu = new TradeMenu(applet);
		buildMenu = new BuildMenu(applet);
		discardMenu = new DiscardMenu(applet);
		menus.add(0, dieMenu);
		menus.add(1, tradeMenu);
		menus.add(2, buildMenu);
		//Applet must be passed for references to endTurn and to turn for isDiceRolled
		baseMenu = new BaseMenu(size, players, menus, applet);
		handDisplay = new handDisplay(applet.getTurn());
	}
	
	public Menu getBaseMenu(){
		return baseMenu;
	}
	
	public Menu getDiscardMenu(){
		return discardMenu;
	}
	
	//check when for mouseClicked. Checks for overlaps on all the menus
	public void checkOverlaps(int x, int y){
		//test code
		((BaseMenu)baseMenu).checkOverlaps(x, y);
		((BuildMenu)buildMenu).checkOverlaps(x, y);
	}
	
	//draws all menus
	public void drawSelf(Graphics g){
		baseMenu.drawSelf(g);
		buildMenu.drawSelf(g);
		handDisplay.drawSelf(g);
		dieMenu.drawSelf(g);
		discardMenu.drawSelf(g);
		tradeMenu.drawSelf(g);
//		System.out.println("handDisplay draw");
	}
}
